
package com.rx.mgt.dao;  

import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.rx.mgt.dao.base.ManagementHibernateDaoBase;
import com.rx.mgt.domain.ScheduleTask;
import com.rx.mgt.po.UsersBo;

/** 
 * ClassName:ScheduleTaskDao 
 * Function :
 * Reason   : 
 * Date     :Feb 6, 2017 9:30:21 AM 
 * @author   luolei 
 * @since    JDK 1.6
 */
@Repository
public class ScheduleTaskDao extends ManagementHibernateDaoBase<ScheduleTask, Long>{
    @Transactional(readOnly=true)
    public List getAllTask(UsersBo usersBo){
        String hql= " from ScheduleTask au where 1=1  ";
        if(StringUtils.isNotBlank(usersBo.getDomain())){
            hql=hql +" and au.domain=:domain";
        }
        Query query = template.getSessionFactory().getCurrentSession().createQuery(hql);
        if(StringUtils.isNotBlank(usersBo.getDomain())){
            query.setParameter("domain", usersBo.getDomain());
        }
        return query.list();
    }
}
  